<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
        }
        .red {
            background-color: #f00;
        }
        .blue {
            background-color: #00f;
        }
    </style>
</head>
<body>
    <div id="app">
        <button @click=" show = !show ">切换</button>

        <div v-if="show" class="box red"></div>
        <div v-show="show" class="box blue"></div>


        <!-- v-if可以写双分支 -->
        <div v-if="age >= 18">去网吧偷耳机</div>
        <div v-else>去公园捡垃圾</div>


        <!-- v-if还可以写多分支 -->
        <!-- 康伟东发工资了，决定让自己过得好一点，所以就看他现在剩了多少钱 -->
        <div v-if="money >= 2000">去按摩</div>
        <div v-else-if="money >= 1000">去洗脚</div>
        <div v-else-if="money >= 500">去吃饭</div>
        <div v-else>去乞讨</div>

    </div>

    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    show: false,
                    age: 19,
                    money: 2100
                }
            },
        })
    </script>
</body>
</html>